package com.example.a10928.weifriend.binding;

import android.databinding.BindingAdapter;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;


public class ViewBindingAdapter {

    @BindingAdapter("android:visibility_visible")
    public static void setVisibilityVisible(@NonNull View view, @Nullable Boolean visible) {
        int visibility = (visible != null && visible) ? View.VISIBLE : View.GONE;
        view.setVisibility(visibility);
    }

    @BindingAdapter("android:visibility_invisible")
    public static void setVisibilityInvisible(@NonNull View view, @Nullable Boolean visible) {
        int visibility = (visible != null && visible) ? View.VISIBLE : View.INVISIBLE;
        view.setVisibility(visibility);
    }

    @BindingAdapter("android:visibility_invisible_double")
    public static void setVisibilityInvisibleDouble(@NonNull View view, @Nullable Boolean visible) {
        int visibility = (visible != null && visible) ? View.INVISIBLE : View.GONE;
        view.setVisibility(visibility);
    }




}
